﻿using IXION.BLOG.DOMAIN.BLOG;
using System;
using System.Collections.Generic;
using System.Web;

namespace IXION.BLOG.COMMON.CONFIG
{
    public class ConfigReader
    {
        public static string GetConfigInfo(string key) {
            return System.Configuration.ConfigurationManager.AppSettings[key].ToString();
        }
        public static Blog LoadBlogInfo (){ 
            Blog blog = new  Blog();
            BlogCommonSetting setting = new BlogCommonSetting();
            blog.BlogName = GetConfigInfo("BlogName");
            blog.BlogSubName = GetConfigInfo("BlogSubName");
            blog.Description = GetConfigInfo("Description"); ;
            blog.CopyRight = GetConfigInfo("CopyRight");
            setting.ArticleCountPerPage = int.Parse(GetConfigInfo("ArticleCountPerPage"));
            setting.IndexTagsCount = int.Parse(GetConfigInfo("IndexTagsCount"));
            setting.NewArticleCount = int.Parse(GetConfigInfo("NewArticleCount"));
            setting.PagerBarLength = int.Parse(GetConfigInfo("PagerBarLength"));
            blog.CommonSetting = setting;
            return blog;
        }
    }
}